/*****************************************************************************
 * Copyright (c) 2010 -, Anders All rights reserved
 * 
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 *  This program is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License
 *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
 * 
 *  Contact: Anders Uddenberg (anders.uddenberg@gmail.com)
 * 
 *
 ****************************************************************************/
package org.easypr.organizer.client.view;

import org.easypr.organizer.client.presenter.InformationPresenter;

import com.google.gwt.user.client.Timer;
import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.FlowPanel;
import com.google.gwt.user.client.ui.Label;
import com.google.gwt.user.client.ui.Widget;

// TODO: Auto-generated Javadoc
/**
 * The Class InformationView.
 */
public class InformationView extends Composite implements InformationPresenter.Display {

	/** The container. */
	FlowPanel container;
	

	/**
	 * Instantiates a new menu view.
	 */
	public InformationView() {
		container = new FlowPanel();
		initWidget(container);
		
	}
	
	/* (non-Javadoc)
	 * @see org.easypr.organizer.client.presenter.InformationPresenter.Display#setData(java.lang.String, java.lang.String)
	 */
	public void setData(String message, String css) {
		Timer t = new Timer() {
	      public void run() {
	    	  container.clear();
	      }
	    };
		container.clear();

		FlowPanel info = new FlowPanel();
		info.setStyleName(css);
		info.add(new Label(message));
		container.add(info);
		t.schedule(5000);
	}

	/* (non-Javadoc)
	 * @see org.easypr.organizer.client.presenter.InformationPresenter.Display#asWidget()
	 */
	@Override
	public Widget asWidget() {
		return this;
	}
}
